package com.ydj.framework.utils;


import java.util.Map;

/**
 * 搜索工具类
 *
 * @author Max
 */
public class SearchUtils {
	/**
	 * 更新最值
	 *
	 * @param target    对比目标
	 * @param minName   最小值的变量名
	 * @param maxName   最大值的变量名
	 */
	public static void updateMinAndMax(Long target, String minName, String maxName, Map<String, Long> minOrMaxMap) {
		Long min = minOrMaxMap.get(minName);
		Long max = minOrMaxMap.get(maxName);
		if (target != null) {
			if (min == null || min > target) {
				minOrMaxMap.put(minName, target);
			}
			if (max == null || max < target) {
				minOrMaxMap.put(maxName, target);
			}
		}
	}
}